package com.test.controller;

import java.util.List;

import com.jfinal.core.Controller;
import com.test.model.User;

public class HomeController extends Controller{
	
	public void index(){
		render("/login.jsp");
	}
	
	public void login(){
		String username = getPara("username");
		String password = getPara("password");
		String sql = "select * from user where username='"+username+"' and password = '"+password+"'";
		List<User> list = User.dao.find(sql);
		if(list !=null && list.size() > 0){
			setSessionAttr("user", list.get(0));
			render("/article_common.jsp");
		}else{
			forwardAction("/");
		}
	}
}